package com.lancoo.ccas52.controller;

import com.lancoo.ccas52.entity.Student;
import com.lancoo.ccas52.entity.Teacher;
import com.lancoo.ccas52.pojo.vo.PublishStatisticsPre;
import com.lancoo.ccas52.pojo.vo.TeacherGroupCollege;
import com.lancoo.ccas52.service.TeacherService;
import com.lancoo.ccas52.service.TeachingClassService;
import com.lancoo.ccas52.util.ResponseObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 教师 前端控制器
 * </p>
 *
 * @author quin.song
 * @since 2023-01-31
 */
@Slf4j
@Api(tags = "教师相关接口")
@RestController
@RequestMapping("/api/v5.2.1/pc/teacher")
public class TeacherController {
    @Resource
    private TeacherService teacherService;
    @Resource
    private TeachingClassService teachingClassService;

    @ApiOperation("获取全部教师 根据学院分组")
    @GetMapping(value = "/getTeacherList")
    public ResponseObject<List<TeacherGroupCollege>> getTeacherListGroupCollege(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                                                @ApiParam(value = "学校Id", required = true) @RequestParam String schoolId,
                                                                                @ApiParam(value = "学期", required = true) @RequestParam String term) {
        return ResponseObject.ofSuccess(teacherService.getAllTeacherGroupCollege(schoolId,term));
    }

    @ApiOperation("根据课程id获取已分配的教师")
    @GetMapping(value = "/getTeacherById")
    public ResponseObject<List<Teacher>> getTeacherById(@ApiParam(value = "课程id", required = true) @RequestParam Long courseId,
                                                        @ApiParam(value = "0无需选课 1在线选课;2:分级教学 3:预选教学班", required = true) @RequestParam Integer teachingClassType) {
        return ResponseObject.ofSuccess(teachingClassService.getTeacherByCourseId(courseId,teachingClassType));
    }

    @ApiOperation("根据教学班id获取教师列表")
    @GetMapping(value = "/getTeacherByTeachingId")
    public ResponseObject<List<Teacher>> getTeacherByTeachingId(@ApiParam(value = "教学班id", required = true) @RequestParam Long teachingClassId) {
        return ResponseObject.ofSuccess(teachingClassService.getTeacherByTeachingId(teachingClassId));
    }

    @ApiOperation("根据基础平台老师Id获取老师信息")
    @GetMapping(value = "/getTeacherInfoByBaseTeacherId")
    @Deprecated
    public ResponseObject<Teacher> getStudentInfoByBaseStudentId(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                                 @ApiParam(value = "学校Id", required = true) @RequestParam String schoolId,
                                                                 @ApiParam(value = "学期", required = true) @RequestParam String term,
                                                                 @ApiParam(value = "基础平台老师id ", required = true) @RequestParam String baseTeacherId) {
        return ResponseObject.ofSuccess(teacherService.getTeacherByBaseId(schoolId,term, baseTeacherId));
    }


}
